home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / umich / telecomm / bbsxdemo.lzh / OE / OE.SCR < prev    next >
Encoding:
Text File  |  1993-01-03  |  15.3 KB  |  591 lines

  1. script
  2.  
  3. ;     Online Order Entry System for BBS Express! ST
  4. ;       written by Keith Ledbetter     14-Sept-87
  5. ;     ---------------------------------------------
  6.  
  7.  abort off
  8.  
  9.  clear screen
  10.  define   Top_Of_Page                ;item # at top of screen
  11.  define   Total_items
  12.  define   Instr                      ;generic input field
  13.  define   Count
  14.  define   Temp
  15.  define   Pointer                    ;generic pointer field
  16.  
  17.  define  Text_Path       = 'd:\bbsxdemo\oe\dat\'             ;where the text is
  18.  define  orders_filename = 'd:\bbsxdemo\oe\dat\orders.dat'   ;orders dataset
  19.  define  info_filename   = 'd:\bbsxdemo\oe\dat\info.dat'     ;info dataset
  20.  
  21.  define  Allow_MasterCard = 'YES'    ;change these to the        <<--------
  22.  define  Allow_VISA       = 'YES'    ; credit cards you want to
  23.  define  Allow_AMExpress  = 'YES'    ; allow..  ('YES' or 'NO')
  24.  define  Allow_COD        = 'YES'    ; >>> NOTE: NOT IN USE YET!
  25.  
  26.  define  Datafile                   ;the data file we're reading now
  27.  define  Return_To                  ;file to execute when done
  28.  
  29.  define  product                 ;the product they are ordering
  30.  define  quantity                ;quantity they want
  31.  define  name                    ;to ship to
  32.  define  address
  33.  define  city
  34.  define  state
  35.  define  zip_code
  36.  define  day_phone
  37.  define  night_phone
  38.  define  payment_type
  39.  define  acct_number              ;(if charge)
  40.  define  exp_date                 ;card's expiration date
  41.  define  bank_name                ;bank name
  42.  define  bank_number              ;bank number (if Mastercard)
  43.  define  spec_instr               ;special instructions
  44.  define  video_width  = '&11'     ;user's video width
  45.  define  current_time = '&23'     ;timestamp
  46.  define  current_date = '&24'     ;datestamp
  47.  define  price
  48.  define  already_asked            ;already asked for info?
  49.  
  50.  [name]        =  &2              ;user's REAL name (from logon record)
  51.  [address]     =  &4
  52.  [city]        =  &5
  53.  [state]       =  &6
  54.  [zip_code]    =  &7
  55.  [day_phone]   =  &8
  56.  [night_phone] =  &8
  57.  
  58.  
  59. ;       Process the category selection
  60. ;       ------------------------------
  61.  
  62. get_category:
  63.  
  64.         [top_of_page] = 1                ; to top of file..
  65.         clear screen
  66.         clear table
  67.         total_items = table_load ('[text_path]category.dat')
  68.         if total_items = 0 then
  69.            printe 'Sorry...that area is being built!'
  70.            exit
  71.         endif
  72.  
  73. GC_main_loop:
  74.   clear screen
  75.   printe
  76.   printe '--------------------------------------' center
  77.   printe ' DEMO VERSION! MAY NOT BE UP TO DATE! ' center
  78.   printe '--------------------------------------' center
  79.   PRINTE
  80.   printe '-------------------------------------' center
  81.   printe ' #   Product Category Selection      ' center
  82.   printe '-------------------------------------' center
  83.  
  84.   gosub get10_items                             ;get a page worth of data
  85.  
  86.  
  87.   printe
  88. GC_re_get:
  89.   print 'P)rev N)ext Q)uit #) To View: ' center
  90.   input [instr] 2
  91.   if [instr] = ''  then
  92.      increase [top_of_page] 10
  93.      goto GC_main_loop
  94.   ef [instr] = NUMERIC then
  95.      goto get_cat_selection
  96.   ef [instr] = 'N' then
  97.      increase [top_of_page] 10
  98.      goto GC_main_loop
  99.   ef [instr] = 'P' then
  100.      decrease [top_of_page] 10
  101.      goto GC_main_loop
  102.   ef [instr] = 'Q' then
  103.      exit
  104.   else
  105.      goto GC_re_get
  106.   endif
  107.  
  108. get_cat_selection:
  109.   if [instr] < 1
  110.      goto GC_re_get
  111.   ef [instr] > [total_items]
  112.      goto GC_re_get
  113.   endif
  114.   datafile    = table_get(instr)
  115.   datafile    = copy (datafile, 36, 12)
  116.   top_of_page = 1                            ; to top of file..
  117.   goto process_items
  118.  
  119.  
  120.  
  121. process_items:
  122.  
  123.         if file_exists ('[text_path][datafile]')
  124.         else
  125. get_out:
  126.            printe '\n\nSorry, that area is under construction!'
  127.            print  '\nPress return...'
  128.            input [instr] 1
  129. leave:
  130.            close
  131.            goto Get_category
  132.         endif
  133.  
  134.         total_items = table_load ('[text_path][datafile]')
  135.  
  136.         if [total_items] = 0
  137.            goto get_out
  138.         endif
  139.  
  140.         clear screen
  141.  
  142. PI_main_loop:
  143.   clear screen
  144.   printe
  145.   printe '-------------------------------------' center
  146.   printe ' #   Product                   Price ' center
  147.   printe '-------------------------------------' center
  148.  
  149.   gosub get10_items                             ;get a page worth of data
  150.  
  151.  
  152.   printe
  153. re_get:
  154.   print 'P)rev N)ext Q)uit #) To View: ' center
  155.   input [instr] 2
  156.  
  157.   if [instr] = ''  then
  158.      increase [top_of_page] 10
  159.      goto PI_main_loop
  160.   ef [instr] = NUMERIC then
  161.      goto info
  162.   ef [instr] = 'N' then
  163.      increase [top_of_page] 10
  164.      goto PI_main_loop
  165.   ef [instr] = 'P' then
  166.      decrease [top_of_page] 10
  167.      goto PI_main_loop
  168.   ef [instr] = 'Q' then
  169.      goto leave
  170.   else
  171.      goto re_get
  172.   endif
  173.  
  174.  
  175. info:
  176.   if [instr] < 1
  177.      goto re_get
  178.   ef [instr] > [total_items]
  179.      goto re_get
  180.   endif
  181.   instr = table_get (instr)
  182.  
  183.   if video_width = 40 then
  184.      temp = copy (instr, 36, 12)
  185.   else
  186.      temp = copy (instr, 50, 12)
  187.   endif
  188.  
  189.   if file_exists ('[text_path][temp]')
  190.      clear screen
  191.      view ('[text_path][temp]')
  192.   else
  193.      PrintE
  194.      PrintE 'No info available on that product' center
  195.   endif
  196.   print '\n\n'
  197.   if video_width = 40 then
  198.      print '(O)rder  (R)equest info  (C)ont: ' center
  199.   else
  200.   print '(O)rder this product  (R)equest info on this product  (C)ont: ' center
  201.   endif
  202.  
  203.   input [temp] 1
  204.   if [temp] = 'O'
  205.      goto go_order
  206.   ef [temp] = 'R'
  207.      goto go_info
  208.   endif
  209.   goto PI_main_loop
  210.  
  211.  
  212. go_order:
  213.   product = copy (instr, 1, 26)
  214.   price   = copy (instr, 28, 6)
  215.   goto Process_order
  216.  
  217.  
  218. go_info:
  219.   product = copy (instr, 1, 26)
  220.   price   = copy (instr, 28, 6)
  221.   goto Process_info
  222.  
  223.  
  224. get10_items:
  225.    if [top_of_page] < 1 then
  226.       [top_of_page] = 1
  227.    endif
  228.    set [pointer] = [top_of_page] + 9
  229.    if [pointer] > [total_items] then
  230.       set [top_of_page] = [total_items] - 9
  231.    endif
  232.    if [top_of_page] < 1 then
  233.       [top_of_page] = 1
  234.    endif
  235.    set [pointer] = [top_of_page]
  236.    set [count] = 1
  237. get10a:
  238.    instr = table_get (pointer)
  239.    if [instr] = '' then
  240.       set [instr] = ' '
  241.       expand [instr] 35
  242.    endif
  243.    instr = copy (instr, 1, 33)
  244.    set [temp] = [pointer]
  245.    if [temp] < 10
  246.       set [temp] = ' [temp]'
  247.    endif
  248.    printe '[temp]. [instr]' center
  249.    increase [pointer]
  250.    increase [count]
  251.    if [pointer] > [total_items] then
  252.       printe
  253.       printe '*** End of Products ***' Center
  254.    ef [count] < 11 then
  255.       goto get10a
  256.    endif
  257.    RETURN
  258.  
  259.  
  260. Process_Order:
  261. abort off
  262.  
  263.   clear screen
  264.   printe '\n\nORDERING: [product]'
  265.   printe '   PRICE: [price]\n'
  266.  
  267.   printe '\iNOTE:\o'
  268.  
  269.   if [video_width] = 40 then
  270.      printe ' You MUST leave 2 valid voice numbers,'
  271.      printe 'since we will validate this order by'
  272.      printe ' a telephone call!'
  273.      printe
  274.      printe ' Credit Card Purchases REQUIRE a'
  275.      printe ' $40 minimum order.!'
  276.      printe
  277.      printe ' IF THE ORDER FORM IS NOT TOTALLY'
  278.      printe ' FILLED OUT, IT WILL BE IGNORED!'
  279.      printe
  280.      printe ' There is a $4.00 minimum shipping'
  281.      printe ' charge on your total order.'
  282.      printe
  283.      printe ' You can ABORT this order at ANY time'
  284.      printe 'by entering "ABORT" at the main prompt.'
  285.   else
  286.      printe 'You MUST leave 2 valid voice numbers, since we will'
  287.      printe 'validate this order by a telephone call!'
  288.      printe
  289.      printe ' Credit Card Purchases REQUIRE a $40 minimum order.!'
  290.      printe
  291.      printe ' IF THE ORDER FORM IS NOT TOTALLY FILLED OUT, IT WILL BE IGNORED!'
  292.      printe
  293.      printe ' There is a $4.00 minimum shipping charge on your total order.'
  294.      printe
  295.      print  ' You can ABORT this order at ANY time '
  296.      printe 'by entering "ABORT" at the main prompt.'
  297.   endif
  298.  
  299.   printe
  300.   print 'Press <return> to fill out order form..'
  301.  
  302.   input [instr] 5
  303.  
  304.   if [instr] = 'abort'
  305.      goto GO_done
  306.   endif
  307.  
  308.   set [quantity]     = '(not yet entered)'
  309.   set [payment_type] = '(not yet entered)'
  310.  
  311. GO_main:
  312.   clear screen
  313.   printe
  314.   printe '   You MUST fill in all data that\vsays \"(not yet entered)\"'
  315.   printe
  316.   printe ' Product: [product]'
  317.   printe '   Price: [price]'
  318.   printe
  319.   printe ' (A) Quantity    : [quantity]'
  320.   printe ' (B) Name        : [name]'
  321.   printe ' (C) Address     : [address]'
  322.   printe ' (D) City        : [city]'
  323.   printe ' (E) State       : [state]'
  324.   printe ' (F) Zip Code    : [zip_code]'
  325.   printe ' (G) Day Phone   : [day_phone]'
  326.   printe ' (H) Night Phone : [night_phone]'
  327.   printe ' (I) Payment Type: [payment_type]'
  328.   printe '        Acct. Num: [acct_number]'
  329.   printe '      Expir. Date: [exp_date]'
  330.   printe '      Bank Name  : [bank_name]'
  331.   printe '      Bank Number: [bank_number]'
  332.   printe
  333.   print 'Enter Letter to change, ABORT to exit,\vor OK to process this order: '
  334.  
  335.   input [instr] 5 noreturn
  336.   printe
  337.  
  338.   if [instr] = 'abort'
  339.        goto GO_done
  340.   ef [instr] = 'OK'
  341.        goto save_order
  342.   ef [instr] = 'A'
  343.        print  'Enter Order Quantity: '
  344.        input [quantity] 2 noreturn
  345.   ef [instr] = 'B'
  346.        print  'Enter Your Name: '
  347.        input [name] 25 noreturn
  348.   ef [instr] = 'C'
  349.        print  'Enter Address: '
  350.        input [address] 25 noreturn
  351.   ef [instr] = 'D'
  352.        print  'Enter City: '
  353.        input [city] 25 noreturn
  354.   ef [instr] = 'E'
  355.        print  'Enter State: '
  356.        input [state] 25 noreturn
  357.   ef [instr] = 'F'
  358.        print  'Enter Zip_Code: '
  359.        input [zip_code] 25 noreturn
  360.   ef [instr] = 'G'
  361.        printe ' Enter a telephone number where we'
  362.        printe ' can reach you in the DAYTIME.'
  363.        print  ' -> '
  364.        input [day_phone] 20 noreturn
  365.   ef [instr] = 'H'
  366.        printe ' Enter a telephone number where we'
  367.        printe ' can reach you at NIGHT.'
  368.        print  ' -> '
  369.        input [night_phone] 20 noreturn
  370.   ef [instr] = 'I'
  371.        gosub get_charge
  372.   endif
  373.  
  374.   goto GO_main
  375.  
  376.  
  377.  
  378. get_charge:
  379.   printe
  380.   printe '      Payment Type'
  381.   printe
  382.   printe ' 1.  VISA'
  383.   printe ' 2.  Master Card'
  384.   printe ' 3.  COD ($2 additional)'
  385.   printe
  386.  
  387. reget_charge:
  388.  
  389.   print  '     Selection: '
  390.   input [instr] 1 noreturn
  391.  
  392.   if [instr] = '1' then
  393.       set [payment_type] = 'VISA'
  394.   ef [instr] = '2' then
  395.       set [payment_type] = 'Master Card'
  396.   ef [instr] = '3' then
  397.       set [payment_type] = 'COD'
  398.       set [acct_number] = 'Not needed'
  399.       set [bank_name]   = 'Not needed'
  400.       set [bank_number] = 'Not needed'
  401.       set [exp_date]    = 'Not needed'
  402.       RETURN
  403.   else
  404.       goto reget_charge
  405.   endif
  406.  
  407.   printe
  408.   printe 'Enter Your [payment_type] Number '
  409.   print  '-> '
  410.   input [acct_number] 20 noreturn
  411.  
  412.   printe
  413.   printe 'Enter the expiration date of your'
  414.   print  '[payment_type] card: '
  415.   input [exp_date] 8 noreturn
  416.  
  417.   if [payment_type] = 'Master Card' then
  418.      printe
  419.      printe 'Enter the BANK NUMBER that appears'
  420.      print  'on your [payment_type] card: '
  421.      input [bank_number] 4 noreturn
  422.   else
  423.      set [bank_number] = 'Not needed'
  424.   endif
  425.  
  426.   printe
  427.   printe 'Enter the BANK NAME that appears'
  428.   print  'on your [payment_type] card: '
  429.   input [bank_name] 25 noreturn
  430.   RETURN
  431.  
  432.  
  433.  
  434. save_order:
  435.  
  436.   if [quantity] = '(not yet entered)'           ;can't let them out
  437.      goto GO_main                                  ; without this stuff!
  438.   ef [payment_type] = '(not yet entered)'
  439.      goto GO_main
  440.   endif
  441.  
  442.   printe
  443.   printe
  444.   printe 'Thank you for placing an order with us!'
  445.   printe
  446.   print 'Please wait while I record this...'
  447.  
  448.   open [orders_filename] append
  449.   fprinte ; added 3jan93, r.s.
  450.   fprinte ; added 3jan93, r.s.
  451.   fprinte ; added 3jan93, r.s.
  452.   fprinte ; added 3jan93, r.s.
  453.   fprinte
  454.   fprinte
  455.   fprinte '-----------------------------------------------'
  456.   fprinte '  Product    : [product] [price]'
  457.   fprinte '  Quantity   : [quantity]'
  458.   fprinte '  Placed at  : [current_time] on [current_date]'
  459.   fprinte '  User Number: &31'
  460.   fprinte '  Name       : [name]'
  461.   fprinte '  Address    : [address]'
  462.   fprinte '  City       : [city]'
  463.   fprinte '  State      : [state]'
  464.   fprinte '  Zip Code   : [zip_code]'
  465.   fprinte '  Day Phone  : [day_phone]'
  466.   fprinte '  Night Phone: [night_phone]'
  467.   fprinte ' Payment Type: [payment_type]'
  468.   fprinte '    Acct. Num: [acct_number]'
  469.   fprinte '  Expir. Date: [exp_date]'
  470.   fprinte '  Bank Name  : [bank_name]'
  471.   fprinte '  Bank Number: [bank_number]'
  472.  
  473.   close
  474.  
  475.   printe 'done!'
  476.   printe
  477.   printe 'Your order has been processed...thanks!'
  478.   printe
  479.   print  'Press <return> to continue...'
  480.   input [instr] 1
  481.  
  482. GO_done:
  483.   goto PI_Main_Loop                     ;back to browsing!
  484.  
  485. Process_Info:
  486.   abort off
  487.   if already_asked = 'y' then        ;already gave us their address
  488.      goto add_on_info
  489.   endif
  490.  
  491. GI_main:
  492.   clear screen
  493.   printe
  494.   printe ' Product: [product]'
  495.   printe
  496.   printe ' Product information will be sent to\vyou at the following address:'
  497.   printe
  498.   printe ' (A) Name        : [name]'
  499.   printe ' (B) Address     : [address]'
  500.   printe ' (C) City        : [city]'
  501.   printe ' (D) State       : [state]'
  502.   printe ' (E) Zip Code    : [zip_code]'
  503.   printe ' (F) Day Phone   : [day_phone]'
  504.   printe ' (G) Night Phone : [night_phone]'
  505.   printe
  506.   print 'Enter Letter to change, ABORT to exit,\vor OK to process: '
  507.  
  508.   input [instr] 5 noreturn
  509.   printe
  510.  
  511.   if [instr] = 'abort'
  512.        goto GI_done
  513.   ef [instr] = 'OK'
  514.        goto save_info
  515.   ef [instr] = 'A'
  516.        print  'Enter Your Name: '
  517.        input [name] 25 noreturn
  518.   ef [instr] = 'B'
  519.        print  'Enter Address: '
  520.        input [address] 25 noreturn
  521.   ef [instr] = 'C'
  522.        print  'Enter City: '
  523.        input [city] 25 noreturn
  524.   ef [instr] = 'D'
  525.        print  'Enter State: '
  526.        input [state] 25 noreturn
  527.   ef [instr] = 'E'
  528.        print  'Enter Zip_Code: '
  529.        input [zip_code] 25 noreturn
  530.   ef [instr] = 'F'
  531.        printe ' Enter a telephone number where we'
  532.        printe ' can reach you in the DAYTIME.'
  533.        print  ' -> '
  534.        input [day_phone] 20 noreturn
  535.   ef [instr] = 'G'
  536.        printe ' Enter a telephone number where we'
  537.        printe ' can reach you at NIGHT.'
  538.        print  ' -> '
  539.        input [night_phone] 20 noreturn
  540.   endif
  541.  
  542.   goto GI_main
  543.  
  544. save_info:
  545.  
  546.   printe
  547.   printe
  548.   print 'Please wait while I record this...'
  549.  
  550.   open [info_filename] append
  551.   fprinte
  552.   fprinte
  553.   fprinte '-----------------------------------------------'
  554.   fprinte '  Product    : [product]'
  555.   fprinte '  Placed at  : [current_time] on [current_date]'
  556.   fprinte '  User Number: &31'
  557.   fprinte '  Name       : [name]'
  558.   fprinte '  Address    : [address]'
  559.   fprinte '  City       : [city]'
  560.   fprinte '  State      : [state]'
  561.   fprinte '  Zip Code   : [zip_code]'
  562.   fprinte '  Day Phone  : [day_phone]'
  563.   fprinte '  Night Phone: [night_phone]'
  564.  
  565.   close
  566.  
  567.   printe 'done!'
  568.   printe
  569.   already_asked = 'y'
  570.   printe 'Your request has been processed...thanks!'
  571.   printe
  572.   print  'Press <return> to continue...'
  573.   input [instr] 1
  574.  
  575. GI_done:
  576.   goto PI_Main_Loop                     ;back to browsing!
  577.  
  578. Add_on_Info:
  579.   printe
  580.   print 'Adding to your previous request...'
  581.  
  582.   open [info_filename] append
  583.   fprinte '   ADDITIONAL: [product]'
  584.   close
  585.   printe 'done!'
  586.   printe
  587.   print  'Press <return> to continue...'
  588.   input [instr] 1
  589.   goto PI_Main_Loop                     ;back to browsing!
  590.  
  591.